'''
Created on Mar 14, 2012

@author: root
'''

import os
import csv


class BaseMenu:
    
    choice = 0
    menuCnt = 0
    
    def BuildMenu(self,title,menuItems,menuOptions): 
       
        os.system('clear')
        print "-----------------------------------"
        print title
        print "-----------------------------------"
        menuCnt = 0
        for item in menuItems:
            menuCnt += 1
            print str(menuCnt) + ") " + item
        self.choice = raw_input("\nEnter your choice : ")
        if (int(self.choice) < 1) or (int(self.choice) > len(menuOptions)+1):
            return -1
        elif (int(self.choice) == len(menuOptions)+1): 
            return 0
        else:
            return int(self.choice)

    def __init__(self):
        '''
         No Init
        '''